package com.itheima.a01myfunction;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public class FunctionDemo2 {
    public static void main(String[] args) {
        /**
         * 集合中有以下数字，要求把他们都变成int类型
         * “1”“2”“3”“4”“5”
         */
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"1", "2", "3", "4", "5");

        List<Integer> res = list.stream().map(Integer::parseInt).collect(Collectors.toList());
        System.out.println(res);
    }
}
